package ar.edu.caece.compiler.symbol;

import static ar.edu.caece.compiler.symbol.Symbol.Type.TERMINAL;

public class TerminalSymbol extends Symbol {

  private final static String INDETIFIER_SUBTYPE = "IDENTIFIER";
  
  private String subtype;
  
  private String recognizerClass;
  
  public TerminalSymbol(String lexema, String subtype, String recognizerClass) {
    super(lexema, TERMINAL);
    this.subtype = subtype;
    this.recognizerClass = recognizerClass;
  }

  public TerminalSymbol(TerminalSymbol symbol, String lexema) {
    super(lexema, TERMINAL);
    this.subtype = symbol.subtype;
    this.recognizerClass = symbol.recognizerClass;
  }  
  
  public static boolean isIndentifier(Symbol symbol) {
    return symbol instanceof TerminalSymbol && ((TerminalSymbol)symbol).getSubtype().equals(INDETIFIER_SUBTYPE);
  }

  public String getSubtype() {
    return subtype;
  }

  public void setSubtype(String subtype) {
    this.subtype = subtype;
  }

  public String getRecognizerClass() {
    return recognizerClass;
  }

  public void setRecognizerClass(String recognizerClass) {
    this.recognizerClass = recognizerClass;
  }
}
